#include "widget.h"
#include "ui_widget.h"
#include<QPushButton>
#include<QDebug>
Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
    ,button1(new QPushButton(this))
    ,button2(new QPushButton(this))
{
    ui->setupUi(this);
    button1->setText("按钮");
    button1->move(100,100);
    button2->setText("切换状态按钮！");
    connect(button1,&QPushButton::clicked,this,&Widget::Push1);
    connect(button2,&QPushButton::clicked,this,&Widget::Push2);
}

Widget::~Widget()
{
    delete ui;
}
void Widget::Push1()
{
    qDebug()<<"执行了槽函数！";
}
void Widget::Push2()
{
    bool flag=button1->isEnabled();
    if(flag==true)
    {
        button1->setEnabled(false);
    }
    else
    {
        button1->setEnabled(true);
    }
}

